package com.example.pattern.interpreter;

/**
 * 非终结符表达式类，实现抽象表达式接口，对文法中的非终结符进行解释操作
 *
 * @author FM_南风
 * @date 2024/7/7
 */
public class OrExpression implements Expression {
	private Expression expr1;
	private Expression expr2;

	public OrExpression(Expression expr1, Expression expr2) {
		this.expr1 = expr1;
		this.expr2 = expr2;
	}

	@Override
	public boolean interpret(String context) {
		return expr1.interpret(context) || expr2.interpret(context);
	}
}
